package mysql;

import utils.Base;
import utils.titles.Title;

import static utils.titles.Title.SNAKE_CASE;

/**
 * Created by nuno-rafael-figueiredo on 01-07-2014.
 */
public class MySQL {
    public static String wrap(String name) {
        return "`" + name + "`";
    }

    /**
     * Created by nuno-rafael-figueiredo on 01-07-2014.
     */
    public static class Object extends Base {

        private final Object container;

        public Object(Title title) {
            this(title, null);
        }

        public Object(Title title, Object container) {
            super(SNAKE_CASE, title);
            this.container = container;
        }

        public String qualify(){
            return (container == null ? "" : container.qualify() + ".") + wrap();
        }

        public String wrap() {
            return MySQL.wrap(getName());
        }
    }
}
